package com.netpace.iem.umair.dal;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBUtil {
	private static final String USERNAME = "admin";
	private static final String PASSWORD = "admin";
	private static final String MYSQL_CONN_STRING = 
			"jdbc:mysql://localhost/dbName";
	private static final String SQLSERVER_CONN_STRING = 
			"jdbc:mssqlserver://localhost/dbName";
	private static final String ORACLE_CONN_STRING = 
			"jdbc:oracle://localhost/dbName";
	
	public static Connection getConnection(DBTYPE dbType) throws SQLException {
		
		switch (dbType) {
		case MYSQL:
			return DriverManager.getConnection(MYSQL_CONN_STRING, USERNAME, PASSWORD);
		case SQLSERVER:
			return DriverManager.getConnection(SQLSERVER_CONN_STRING, USERNAME, PASSWORD);
		case ORACLE:
			return DriverManager.getConnection(ORACLE_CONN_STRING, USERNAME, PASSWORD);
		default:
			return null;
		}
	}
}
